#include <iostream>
#include <iomanip>
#include <queue>
#include <map>
using namespace std;
const int m = 1000000007;
int main() {
    long long a[1001], b[1001], n;
    a[1] = 1;
    a[2] = 6;
    b[1] = 1;
    b[2] = 2;
    cin >> n;
    if (n == 1) {
        cout << 2; return 0;
    }
    if (n == 2) {
        cout << 24; return 0;
    }
    for (int i = 3; i <= n; i++) {
        b[i] = 2 * b[i - 1] % m;
        a[i] = (2 * a[i - 1] + 2 * 2 * a[i - 2] + b[i]) % m;
    }
    long long sum = 4 * a[n] % m;
    for (int i = 2; i < n; i++) {
        sum = (sum + 4 * (b[i] * a[n - i] + b[n - i + 1] * a[i - 1])) % m;
    }
    cout << sum;
    return 0;
}